package com.creditease.tmsp.modules.sys.entity;

import java.util.Date;
import java.util.List;

import javax.persistence.Transient;

import org.apache.commons.lang3.StringUtils;

import com.google.common.collect.Lists;

public class SysRole {
    private String id;

    private String name;

    private String creatorId;

    private Date createTime;

    private String remarks;

    private String delFlag;

	private List<SysResource> sysResourceList = Lists.newArrayList(); // 拥有菜单列表
	
	public String getSysResourceIds() {
		List<String> nameIdList = Lists.newArrayList();
		for (SysResource sysResource : sysResourceList) {
			nameIdList.add(sysResource.getId());
		}
		return StringUtils.join(nameIdList, ",");
	}
	
	public void setSysResourceIds(String sysResourceIds) {
		sysResourceList = Lists.newArrayList();
		if (sysResourceIds != null){
			String[] ids = StringUtils.split(sysResourceIds, ",");
			for (String sysResourceId : ids) {
				SysResource sysResource = new SysResource();
				sysResource.setId(sysResourceId);
				sysResourceList.add(sysResource);
			}
		}
	}
    
    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id == null ? null : id.trim();
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name == null ? null : name.trim();
    }

    public String getCreatorId() {
        return creatorId;
    }

    public void setCreatorId(String creatorId) {
        this.creatorId = creatorId == null ? null : creatorId.trim();
    }

    public Date getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    public String getRemarks() {
        return remarks;
    }

    public void setRemarks(String remarks) {
        this.remarks = remarks == null ? null : remarks.trim();
    }

    public String getDelFlag() {
        return delFlag;
    }

    public void setDelFlag(String delFlag) {
        this.delFlag = delFlag == null ? null : delFlag.trim();
    }
}